home *** CD-ROM | disk | FTP | other *** search
- Path: news.bellglobal.com!news
- From: montagp@execulink.com (Paul Montag)
- Newsgroups: comp.lang.c++
- Subject: File Access
- Date: 9 Mar 1996 02:59:46 GMT
- Organization: Bell Global Solutions
- Message-ID: <4hqs72$ci4@news.bellglobal.com>
- NNTP-Posting-Host: ppp30.execulink.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- Hi. I am trying to access a Pascal created data file with the following
- record format:
-
- MSGTOIDXrecord = string[35];
-
- USERONrecord = record
- Name,
- Handle : MSGTOIDXrecord;
- Line : Byte;
- Baud : Word;
- City : String[25];
- Status,
- Attribute : Byte;
- StatDesc : String[10];
- FreeSpace : Array[1..98] of Byte;
- NoCalls : Word;
- end;
-
-
-
- Multiple records of this type could be contained in this file however I am not
- really worried about this right now. Here is what I have in C++ so far:
-
- /**************************************************************************/
-
- #include <iostream.h>
- #include <fstream.h>
- #include <string.h>
-
- struct USERONtype
- {
- char Name[35],Handle[35]; //PRETTY SURE THIS IS RIGHT!
- unsigned Line;
- char City[25];
- unsigned char Status, Attribute;
- char StatDesc[10];
- unsigned char FreeSpace[97];
- unsigned int NoCalls;
- };
-
-
- int main (void)
- {
- USERONtype UserOn;
-
- ifstream inFile ("e:\\ra\\useron.bbs", ios::binary);
-
- inFile.get (UserOn.Name, 35); // <- NOT SURE ABOUT HOW TO READ IN THE
- // Information.
-
- inFile.close();
-
- return 0;
- }
-
- /**************************************************************************/
-
- I have worked with files in CPP before, just random access files(at least
- thats what I think this is called) that store records like this. If anyone
- has any ideas please let me know. Thanks!!!
-
-
- Paul Montag
- Internet: montagp@execulink.com
- FidoNet: 1:2401/501
-
-